package com.byb.server.service.mapper;

import com.byb.server.domain.*;
import com.byb.server.service.dto.ProtectScopeDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity ProtectScope and its DTO ProtectScopeDTO.
 */
@Mapper(componentModel = "spring", uses = {ProductMapper.class, })
public interface ProtectScopeMapper extends EntityMapper <ProtectScopeDTO, ProtectScope> {

    @Mapping(source = "product.id", target = "productId")
    ProtectScopeDTO toDto(ProtectScope protectScope); 

    @Mapping(source = "productId", target = "product")
    ProtectScope toEntity(ProtectScopeDTO protectScopeDTO); 
    default ProtectScope fromId(Long id) {
        if (id == null) {
            return null;
        }
        ProtectScope protectScope = new ProtectScope();
        protectScope.setId(id);
        return protectScope;
    }
}
